package com.study.component2;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @Author tanglingyu
 * @Date: 2021/09/01/ 10:47
 * @Description
 */
public class CustomerImportSelector implements ImportBeanDefinitionRegistrar {


  @Override
  public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
      BeanDefinitionRegistry registry) {
    RootBeanDefinition userBeanDefinition = new RootBeanDefinition(MyBean4.class);
    userBeanDefinition.setScope(ConfigurableBeanFactory.SCOPE_PROTOTYPE);
    registry.registerBeanDefinition("sb", userBeanDefinition);
  }
}
